<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;

$this->title = 'create';
?>
<style>
	.add_department .box-footer{text-align:center;border-top:0;}
	.add_department .box-footer button{width:200px;}
</style>
<section class="content">
	<div class="row">
		<div class="col-xs-12">
			<div class="box-header"><h2 class="box-title"><?php if ($model->id){?>客户详情<?php } else {?>新建客户<?php }?></h2></div>
			<div class="box-body add_department">
				<?php $form = ActiveForm::begin(['action' => ['customer/create', 'id' => $model->id], 'method' => 'post']);?>
					<div class="box-body">
						<div class="form-group">
							<label for="deparment_uname">客户名称</label>
							<?=Html::textInput('username', $model->username, ['class' => 'form-control', 'placeholder' => '请输入客户名称']);?>
							<?=Html::error($model, 'username', ['style' => 'color:red'])?>
						</div>
						<div class="form-group">
							<label>客户性别</label>
							<?=Html::radioList('sex', $model->sex, ['M'=>'男', 'F' => '女'],['class'=>'form-control']);?>
							<?=Html::error($model, 'sex', ['style' => 'color:red'])?>
						</div>
						<div class="form-group">
							<label>客户电话</label>
							<?=Html::textInput('mobileNumber', $model->mobileNumber, ['class' => 'form-control', 'placeholder' => '请输入客户电话']);?>
							<?=Html::error($model, 'mobileNumber', ['style' => 'color:red'])?>
						</div>
			            <div class="form-group">
			              <label>客户生日:</label>
			              <div class="input-group date">
			                <div class="input-group-addon">
			                  <i class="fa fa-calendar"></i>
			                </div>
			                <?=Html::textInput('birthday', date('Y-m-d', $model->birthday), ['class' => 'form-control pull-right', 'id' => 'datepicker', 'readonly' => true]);?>
			                <?=Html::error($model, 'birthday', ['style' => 'color:red'])?>
			              </div>
			              <!-- /.input group -->
			            </div>
						<div class="form-group">
							<label>客户地址</label>
							<?=Html::textarea('address', $model->address, ['class' => 'form-control', 'placeholder' => '请输入客户地址']);?>
							<?=Html::error($model, 'address', ['style' => 'color:red'])?>
						</div>	
					</div>
					<div class="box-footer">
						<button type="submit" class="btn btn-primary">确定</button>
					</div>
				<?php ActiveForm::end();?>
			</div>
		</div>
	</div>
</section>

<script src="js/jquery.js"></script>
<script type="text/javascript" src="plugins/date.js" ></script>
<script type="text/javascript" src="plugins/iscroll.js" ></script>
<script src="plugins/jquery.scs.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>

<script>
  $('#datepicker').datepicker({
    autoclose: true,
    initialDate: new Date()
  });
</script>